package cn.liwq.demo.enums.sub;

import cn.liwq.demo.enums.OperationBaseEnum;
import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 操作名称枚举
 *
 * @author lweiqiang
 * @date 2023/1/9
 */
@Getter
@AllArgsConstructor
public enum PurchaseSellOperationEnum implements OperationBaseEnum {

    /** 第一次提交审批相关操作 start */
    SAVE(1, OperationBizTypeEnum.SELL_CONTRACT.getValue(), "保存"),

    UPDATE(2, OperationBizTypeEnum.SELL_CONTRACT.getValue(), "修改"),
    CLOSE(3, OperationBizTypeEnum.SELL_CONTRACT.getValue(), "合同关闭"),
    DISCARD(4, OperationBizTypeEnum.SELL_CONTRACT.getValue(), "合同作废"),
    CANCEL(5, OperationBizTypeEnum.SELL_CONTRACT.getValue(), "取消合同关闭"),
    CHANGE(6, OperationBizTypeEnum.SELL_CONTRACT.getValue(), "变更合同生效"),

    APPROVE(7, OperationBizTypeEnum.SELL_CONTRACT.getValue(), "提交审批"),
    APPROVE_COMPLETE(8, OperationBizTypeEnum.SELL_CONTRACT.getValue(), "审批通过待上传SAP"),

    APPROVE_UPDATE(9, OperationBizTypeEnum.SELL_CONTRACT.getValue(), "审批后修改"),
    UPLOAD_SAP(10, OperationBizTypeEnum.SELL_CONTRACT.getValue(), "上传SAP"),

    UPLOAD_SAP_COMPLETE(11, OperationBizTypeEnum.SELL_CONTRACT.getValue(), "上传SAP成功,审批生效"),

    APPROVE_NOT_COMPLETE(18, OperationBizTypeEnum.SELL_CHANGE_CONTRACT.getValue(), "合同审批不通过"),

    UPLOAD_SAP_NOT_COMPLETE(19, OperationBizTypeEnum.SELL_CHANGE_CONTRACT.getValue(), "上传SAP失败"),
    /** 第一次提交审批相关操作 end */

    /** 以下是变更单相关操作 start*/
    CHANGE_SAVE(12, OperationBizTypeEnum.SELL_CHANGE_CONTRACT.getValue(), "变更合同保存"),
    CHANGE_UPDATE(13, OperationBizTypeEnum.SELL_CHANGE_CONTRACT.getValue(), "变更合同修改"),

    CHANGE_APPROVE(14, OperationBizTypeEnum.SELL_CHANGE_CONTRACT.getValue(), "变更合同提交审批"),
    CHANGE_APPROVE_COMPLETE(15, OperationBizTypeEnum.SELL_CHANGE_CONTRACT.getValue(), "变更合同审批通过待上传SAP"),

    CHANGE_UPLOAD_SAP(16, OperationBizTypeEnum.SELL_CHANGE_CONTRACT.getValue(), "上传SAP"),

    CHANGE_UPLOAD_SAP_COMPLETE(17, OperationBizTypeEnum.SELL_CHANGE_CONTRACT.getValue(), "上传SAP成功,审批生效"),

    CHANGE_APPROVE_NOT_COMPLETE(20, OperationBizTypeEnum.SELL_CHANGE_CONTRACT.getValue(), "变更合同审批不通过"),

    CHANGE_UPLOAD_SAP_NOT_COMPLETE(21, OperationBizTypeEnum.SELL_CHANGE_CONTRACT.getValue(), "上传SAP失败"),

    PROTOCO_CANCEL(22, OperationBizTypeEnum.SELL_CONTRACT.getValue(), "协议作废"),

    PROTOCO_CLOSE(23, OperationBizTypeEnum.SELL_CONTRACT.getValue(), "协议关闭"),

    PROTOCO_REJECTCLOSE(24, OperationBizTypeEnum.SELL_CONTRACT.getValue(), "取消协议关闭"),

    PROTOCOL_DELETE(25, OperationBizTypeEnum.SELL_CONTRACT.getValue(), "协议删除"),

    PROTOCO_REJECT(26, OperationBizTypeEnum.SELL_CONTRACT.getValue(), "审批拒绝"),
    


    /** 变更单相关操作 end*/
    ;

    private Integer value;

    private Integer code;

    private String desc;

    public static PurchaseSellOperationEnum getEnumByDesc(String desc) {
        PurchaseSellOperationEnum[] enums = PurchaseSellOperationEnum.values();
        for (PurchaseSellOperationEnum oe : enums) {
            if (oe.getDesc().equals(desc)) {
                return oe;
            }
        }
        return null;
    }
}
